Conversation
There was a problem hiding this comment.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper reviewto trigger the checks for only added pull request files@algorithms-keeper review-allto trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
|
|
||
|
|
||
| class ARIMA: | ||
| def __init__(self, p=1, d=1, q=1, lr=0.001, epochs=1000) -> None: |
There was a problem hiding this comment.
Please provide type hint for the parameter: p
Please provide descriptive name for the parameter: p
Please provide type hint for the parameter: d
Please provide descriptive name for the parameter: d
Please provide type hint for the parameter: q
Please provide descriptive name for the parameter: q
Please provide type hint for the parameter: lr
Please provide type hint for the parameter: epochs
| self.n_train: int | None = None | ||
| self.sigma_err: float | None = None | ||
|
|
||
| def difference(self, data) -> NDArray[np.float64]: |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file machine_learning/arima.py, please provide doctest for the function difference
Please provide type hint for the parameter: data
| diff = np.diff(diff) # np.diff is a handy function that does exactly this. | ||
| return diff | ||
|
|
||
| def inverse_difference( |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file machine_learning/arima.py, please provide doctest for the function inverse_difference
| prev = next_val | ||
| return forecast | ||
|
|
||
| def _compute_residuals( |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file machine_learning/arima.py, please provide doctest for the function _compute_residuals
| diff_data: NDArray[np.float64], | ||
| phi: NDArray[np.float64], | ||
| theta: NDArray[np.float64], | ||
| c: float, |
There was a problem hiding this comment.
Please provide descriptive name for the parameter: c
|
|
||
| return preds, errors | ||
|
|
||
| def fit(self, data: list[float] | NDArray[np.float64]) -> "ARIMA": |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file machine_learning/arima.py, please provide doctest for the function fit
| self.n_train = len(diff_data) # Assign n_train as an integer | ||
| return self | ||
|
|
||
| def _fit_gradient_descent(self, diff_data: NDArray[np.float64], start: int) -> None: |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file machine_learning/arima.py, please provide doctest for the function _fit_gradient_descent
| msg = f"Fitted params (GD): phi={self.phi},theta={self.theta},c={self.c:.6f}\n" | ||
| print(msg) | ||
|
|
||
| def forecast( |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file machine_learning/arima.py, please provide doctest for the function forecast
|
Closing require_descriptive_names PRs to prepare for Hacktoberfest |
Describe your change:
Added the ARIMA Algorithm.
Checklist: